package com.iatinspur.config;

import com.iatinspur.config.interceptor.MyInterceptor;
import com.iatinspur.config.interceptor.MyInterceptor2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 过滤器实现 HandlerInterceptor接口
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private MyInterceptor interceptor;

    @Autowired
    private MyInterceptor2 interceptor2;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(interceptor)
                .addPathPatterns("/**")
                .order(0);

        registry.addInterceptor(interceptor2)
                .addPathPatterns("/**")
                .order(1);
    }
}
